//
//  RBGBoatOnDemand.m
//  BateauGenerique
//
//  Created by Kevin De Jesus Ferreira on 23/05/2014.
//  Copyright (c) 2014 Kevin De Jesus Ferreira. All rights reserved.
//

#import "RBGBoatOnDemand.h"
#import "RBGNavigationBar.h"
#import "RBGColorManager.h"
#import "RBGAppDelegate.h"
#import "UIImageView+WebCache.h"
#import "Constantes.h"
#import "RBGSelectorValue.h"
#import "Categorie.h"
#import "RBGServiceChargement.h"
#import "Etat.h"
#import "RBGMarqueModeleController.h"
#import "Region.h"
#import "RBGRangeViewController.h"
#import "RBGVendeurController.h"
#import "Lieu.h"

@interface RBGBoatOnDemand ()<RBGSelectorValueDelegate,RBGRangeDelegate,RBGVendeurDelegate>{
    RBGAppDelegate *appDelegate;
    RBGSelectorValue *selectorValue;
    NSMutableArray * facultatif;
    NSMutableArray * requis;
    NSMutableArray *types;
    NSMutableArray *categories;
    NSMutableArray *categories_objects;
    NSString * demand_type;
    NSString * demand_categorie;
    NSString * demand_categorie_id;
    NSString * demand_type_reprise;
    NSString * demand_categorie_reprise;
    NSArray *marques;
    NSString * demand_etat_id;
    NSString * marque_id;
    NSString * modele_id;
    NSString * region_id;
    NSString * taille_min_range;
    NSString * taille_max_range;
    
    
    NSMutableArray *etatsString;
    NSMutableArray *regionString;
    NSString * marque_reprise_id;
    NSString * modele_reprise_id;
    
    BOOL chantierModelReprise;
}

@end

@implementation RBGBoatOnDemand

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self charger];
    [self remplir];
    [self positionnerVue];
    [self chargerCouleur];
    
}

-(void) viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBarHidden = NO;
    self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Retour"
                                                                             style:UIBarButtonItemStyleBordered
                                                                            target:nil
                                                                            action:nil];

    
}

-(void) charger
{
    [self.scrollView setScrollEnabled:YES];
    
    types = [NSMutableArray arrayWithObjects:@"Bateau à moteur", @"Voiliers", @"Semi-rigides", nil];
    
    appDelegate = (RBGAppDelegate *)[[UIApplication sharedApplication] delegate];
    
    selectorValue = [[RBGSelectorValue alloc] initWithNibName:@"RBGSelectorValue" bundle:nil];
    selectorValue.delegate = self;
    
    UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Effacer" style:UIBarButtonItemStylePlain target:self action:@selector(effacer)];
    self.navigationItem.rightBarButtonItem = anotherButton;
    
    
    facultatif = [[NSMutableArray alloc]init];
    requis = [[NSMutableArray alloc]init];
    
}

-(void) effacer
{
    [self effacerValues:requis withValue:@"requis"];
    [self effacerValues:facultatif withValue:@"facultatif"];
}

-(void) remplir
{
    
    [self setTitle:@"Ma Recherche"];
    [RBGNavigationBar customNavigationBar:self.navigationController andTitle:@"Autres" andBackgroundColor:appDelegate.donnees.parametres.backgroundColorUn andTextColor:appDelegate.donnees.parametres.fontColorUn];
    
    [self.logo setImageWithURL:[NSURL URLWithString:appDelegate.donnees.parametres.imageLogo]];
    [self.fond setImageWithURL:[NSURL URLWithString:appDelegate.donnees.parametres.imageFond]];
    
    categories_objects = [appDelegate.donnees.typeCategories objectAtIndex:[demand_type intValue]];
    categories = [NSMutableArray array];
    
    for(Categorie *t in categories_objects){
        [categories addObject:t.libelle];
    }
    regionString = [[NSMutableArray alloc]init];
 
    for(Lieu * l in appDelegate.donnees.lieux){
        if([l isKindOfClass:[Lieu class]])
        [regionString addObject:l.nom];
        else{
            appDelegate.donnees.lieux = nil;
            regionString = nil;
            break;
        }
    }
    
    [requis addObject:self.valueType];
    [requis addObject:self.valueCategorie];
    [requis addObject:self.valueTaille];
    [requis addObject:self.editBudget];
    
    [facultatif addObject:self.valueFacultatif];
    [facultatif addObject:self.valueChantierModele];
    [facultatif addObject:self.valueEtat];
    [facultatif addObject:self.editCommentaire];
    [facultatif addObject:self.valueTypeReprise];
    [facultatif addObject:self.valueCategorieReprise];
    [facultatif addObject:self.valueChantierModeleReprise];
    [facultatif addObject:self.editPrixDeSessionReprise];
    
    
    
}

-(void) positionnerVue
{
    
    [self.logo setFrame:CGRectMake(10, 0, 300, 132)];
    
    [self.descriptionMaRecher setFrame:CGRectMake(10, self.logo.frame.origin.y + self.logo.frame.size.height, self.descriptionMaRecher.frame.size.width, self.descriptionMaRecher.frame.size.height)];
    
    [self.generalitesEnTete setFrame:CGRectMake(0, self.descriptionMaRecher.frame.origin.y + self.descriptionMaRecher.frame.size.height +20, self.generalitesEnTete.frame.size.width, self.generalitesEnTete.frame.size.height)];
    
    [self.generaliteCaracteristique setFrame:CGRectMake(0, self.generalitesEnTete.frame.origin.y + self.generalitesEnTete.frame.size.height, self.generaliteCaracteristique.frame.size.width, self.generaliteCaracteristique.frame.size.height)];
    
    [self.caracteristiqueEnTete setFrame:CGRectMake(0, self.generaliteCaracteristique.frame.origin.y + self.generaliteCaracteristique.frame.size.height+10, self.caracteristiqueEnTete.frame.size.width, self.caracteristiqueEnTete.frame.size.height)];
    
    [self.caracteristiqueAttribut setFrame:CGRectMake(0, self.caracteristiqueEnTete.frame.origin.y + self.caracteristiqueEnTete.frame.size.height, self.caracteristiqueAttribut.frame.size.width, self.caracteristiqueAttribut.frame.size.height)];
    
    [self.repriseEnTete setFrame:CGRectMake(0, self.caracteristiqueAttribut.frame.origin.y + self.caracteristiqueAttribut.frame.size.height+10, self.repriseEnTete.frame.size.width, self.repriseEnTete.frame.size.height)];
    
    [self.repriseAttributs setFrame:CGRectMake(0, self.repriseEnTete.frame.origin.y + self.repriseEnTete.frame.size.height, self.repriseAttributs.frame.size.width, self.repriseAttributs.frame.size.height)];
    
    [self.buttonCoordonnees setFrame:CGRectMake(0, self.repriseAttributs.frame.origin.y + self.repriseAttributs.frame.size.height +20, self.buttonCoordonnees.frame.size.width, self.buttonCoordonnees.frame.size.height)];
    
    self.scrollView.contentSize = CGSizeMake(320, self.repriseAttributs.frame.origin.y + self.repriseAttributs.frame.size.height +20 + self.buttonCoordonnees.frame.size.height+49);
    
}

-(void) chargerCouleur
{
    
    [self.descriptionMaRecher setTextColor:appDelegate.donnees.parametres.fontColorDeux];
    
    [self.generalitesEnTete setBackgroundColor:appDelegate.donnees.parametres.backgroundColorDeux];
    [self.caracteristiqueEnTete setBackgroundColor:appDelegate.donnees.parametres.backgroundColorDeux];
    [self.repriseEnTete setBackgroundColor:appDelegate.donnees.parametres.backgroundColorDeux];
    [self.buttonCoordonnees setBackgroundColor:appDelegate.donnees.parametres.backgroundColorDeux];
    
    self.generaliteTitre.textColor = appDelegate.donnees.parametres.fontColorDeux;
    self.caracteristiquesTitre.textColor = appDelegate.donnees.parametres.fontColorDeux;
    self.caracteristiquesTitre.textColor = appDelegate.donnees.parametres.fontColorDeux;
    
    [RBGColorManager changeTextColorSubViews:self.repriseEnTete withColor:appDelegate.donnees.parametres.fontColorDeux];
    
    [self.buttonCoordonnees setTintColor:appDelegate.donnees.parametres.backgroundColorUn];
    
    [RBGColorManager changeTextColorSubViews:self.generaliteCaracteristique withColor:appDelegate.donnees.parametres.fontColorDeux];
    [RBGColorManager changeTextColorSubViews:self.caracteristiqueAttribut withColor:appDelegate.donnees.parametres.fontColorDeux];
    [RBGColorManager changeTextColorSubViews:self.repriseAttributs withColor:appDelegate.donnees.parametres.fontColorDeux];
    
    [RBGColorManager changeImageColorSubViews:self.generaliteCaracteristique withColor:appDelegate.donnees.parametres.fontColorDeux];
    
    [RBGColorManager changeImageColorSubViews:self.caracteristiqueAttribut withColor:appDelegate.donnees.parametres.fontColorDeux];
    
    [RBGColorManager changeImageColorSubViews:self.repriseAttributs withColor:appDelegate.donnees.parametres.fontColorDeux];
    [self.buttonCoordonnees setTitleColor:appDelegate.donnees.parametres.fontColorDeux forState:UIControlStateNormal];
    
    
}


- (IBAction)changeClearColor:(UIButton *)sender
{
    [sender setBackgroundColor:[UIColor clearColor]];
    
}
- (IBAction)changeColor:(id)sender{
    
    [sender setBackgroundColor:appDelegate.donnees.parametres.backgroundColorDeux];
}

#define TYPE 0
#define CATEGORIE 1
#define CHANTIER_MODELE 2
#define ETAT 3
#define TAILLE 4
#define LIEU 5
#define TYPE_REPRISE 6
#define CATEGORIE_REPRISE 7
#define CHANTIER_MODELE_REPRISE 8


- (IBAction)demanderValue:(UIButton *)sender {
    
    [self changeClearColor:sender];
    
    switch (sender.tag) {
            
        case TYPE:{
            [self demanderType];
        }
            break;
            
        case CATEGORIE:{
            if(![self.valueType.text isEqualToString:@"requis"]){
                [self demanderCategorie];
            }else{
                [self afficherAlerte:@"Veuillez rentrer le champs type"];
            }
            break;
            
        case CHANTIER_MODELE:{
            
            if(![self.valueType.text isEqualToString:@"requis"]){
                chantierModelReprise = false;
                [self demanderChantierModele];
            }else{
                [self afficherAlerte:@"Veuillez rentrer le champs type"];
            }
            
        }
            break;
            
        case ETAT:{
            [self demanderEtat];
            
        }
            break;
            
        case TAILLE:{
            [self demanderTaille];
            
        }
            break;
            
        case LIEU:{
            [self demanderLieu];
            
        }
            break;
            
        case TYPE_REPRISE:{
            [self demanderTypeReprise];
            
        }
            break;
            
        case CATEGORIE_REPRISE:{
            if(![self.valueTypeReprise.text isEqualToString:@"requis"]){
                [self demanderCategorieReprise];
            }else{
                [self afficherAlerte:@"Veuillez rentrer le champs type"];
            }
        }
            break;
            
        case CHANTIER_MODELE_REPRISE:{
            if(![self.valueTypeReprise.text isEqualToString:@"requis"]){
                chantierModelReprise = true;
                [self demanderChantierReprise];
            }else{
                [self afficherAlerte:@"Veuillez rentrer le champs type"];
            }
        }
            break;
        }
    }
}

- (IBAction)fermerCePutinDeClavier:(id)sender {
    UITextField* field = sender;
    [field resignFirstResponder];
}

-(void) afficherAlerte:(NSString *)mes
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Erreur Champs"
                                                    message:mes
                                                   delegate:nil
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles:nil];
    [alert show];
}



-(void) demanderType
{
    selectorValue.values = types;
    selectorValue.facultatif = NO;
    selectorValue.type = TYPE;
    [self.navigationController pushViewController:selectorValue animated:YES];
    
}

-(void) demanderCategorie
{
    selectorValue.type = CATEGORIE;
    
    selectorValue.values = [categories mutableCopy];
    selectorValue.facultatif = YES;
    [self.navigationController pushViewController:selectorValue animated:YES];
}

-(void) demanderChantierModele
{
    NSLog(@"CHANTIER MODELE");
    RBGMarqueModeleController * controller = [[RBGMarqueModeleController alloc]init];
    controller.typeAnnnonce = [demand_type intValue];
    controller.delegate = self;
    controller.filtreController = self;
    [self.navigationController pushViewController:controller animated:YES];
}

-(void) demanderChantierReprise
{
    NSLog(@"CHANTIER MODELE");
    RBGMarqueModeleController * controller = [[RBGMarqueModeleController alloc]init];
    controller.typeAnnnonce = [demand_type intValue];
    controller.delegate = self;
    controller.filtreController = self;
    [self.navigationController pushViewController:controller animated:YES];
}

-(void) demanderEtat
{
    if(appDelegate.donnees.etats == nil || [appDelegate.donnees.etats count] == 0){
        [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
        
        // On va lancer le delegate
        RBGServiceChargement * chargement = [[RBGServiceChargement alloc]init];
        chargement.delegate = self;
        [chargement chargerEtats];
        
    }else{
        
        if(etatsString == nil){
            etatsString = [[NSMutableArray alloc]init];
            for(Etat * e in appDelegate.donnees.etats){
                NSLog(@"%@",e.nomEtat);
                [etatsString addObject:e.nomEtat];
            }
        }
        
        selectorValue.values = [etatsString mutableCopy];
        selectorValue.facultatif = YES;
        selectorValue.type = ETAT;
        [self.navigationController pushViewController:selectorValue animated:YES];
        
    }
    
}

-(void) demanderTaille
{
    NSLog(@"TAILLE");
    [RBGAppDelegate setMinValue:0];
    [RBGAppDelegate setMaxValue:16];
    
    RBGRangeViewController * controller = [[RBGRangeViewController alloc]init];
    
    
    // Do any additional setup after loading the view.
    self.transitionController = [[TransitionDelegate alloc] init];
    controller.view.backgroundColor = [UIColor clearColor];
    [controller setTransitioningDelegate:self.transitionController];
    controller.modalPresentationStyle= UIModalPresentationCustom;
    controller.alphaFond = 0.5;
    controller.cancelable = YES;
    controller.titrePopUp = @"Longueur Range";
    controller.delegate = self;
    
    [self presentViewController:controller animated:YES completion:nil];
}
-(void) demanderLieu
{
    
    if(appDelegate.donnees.lieux == nil || [appDelegate.donnees.lieux count] == 0){
        [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
        
        // On va lancer le delegate
        RBGServiceChargement * chargement = [[RBGServiceChargement alloc]init];
        chargement.delegate = self;
        [chargement chargerLieux];
        
    }else{
        
        if(regionString == nil){
            regionString = [[NSMutableArray alloc]init];
            for(Lieu * l in appDelegate.donnees.lieux){
                [regionString addObject:l.nom];
            }
        }
        
        
        selectorValue.values = [regionString mutableCopy];
        selectorValue.facultatif = YES;
        selectorValue.type = LIEU;
        [self.navigationController pushViewController:selectorValue animated:YES];
        
    }

    

}

-(void) demanderTypeReprise
{
    selectorValue.values = [types mutableCopy];
    selectorValue.facultatif = YES;
    selectorValue.type = TYPE_REPRISE;
    [self.navigationController pushViewController:selectorValue animated:YES];
}

-(void) demanderCategorieReprise
{
    selectorValue.type = CATEGORIE_REPRISE;
    
    selectorValue.values = [categories mutableCopy];
    selectorValue.facultatif = YES;
    [self.navigationController pushViewController:selectorValue animated:YES];
}


- (IBAction)etapeSuivante:(UIButton *)sender {
    
    
   NSMutableDictionary * arguments = [self construireDonnees];
    

    if(arguments != nil){
        RBGVendeurController * controlleur = [[RBGVendeurController alloc]init];
        controlleur.donnees = arguments;
        controlleur.delegate = self;
        [self.navigationController pushViewController:controlleur animated:YES];
    }
    
   // [arguments addEntriesFromDictionary:@{
     //                                     ON_DEMAND_ORIGINE:ON_DEMAND_ORIGINE_VALUE
       //                                   }];
    NSLog(@"Etape Suivante");
    
}


- (void) receiveValueSelected:(int)valueSelected
                andTypeValeur:(int)type
{
    
    switch (type) {
            
        case TYPE:{
            [self.valueType setText:[types objectAtIndex:valueSelected]];
            demand_type = [NSString stringWithFormat:@"%01d",valueSelected];
            demand_categorie = nil;
            [self.valueCategorie setText:@"requis"];
            
        }
            break;
            
        case CATEGORIE:{
            valueSelected +=1;
            demand_categorie = [categories objectAtIndex:valueSelected];
            Categorie *c = [categories_objects objectAtIndex:valueSelected];
            demand_categorie_id = c.id;
            [self.valueCategorie setText:demand_categorie];
        }
            break;
            
        case CHANTIER_MODELE:{
            
        }
            break;
            
        case ETAT:{
            if(valueSelected != -1){
                Etat * e = [appDelegate.donnees.etats objectAtIndex:valueSelected];
                [self.valueEtat setText:e.nomEtat];
                demand_etat_id = e.id;
            }else{
                [self.valueEtat setText:@"Indifférent"];
                
            }
        }
            break;
            
        case TAILLE:{
            
        }
            break;
            
        case LIEU:{
            if(valueSelected != -1){
                Lieu * r = [appDelegate.donnees.lieux objectAtIndex:valueSelected];
                [self.valueFacultatif setText:r.nom];
                region_id = r.id;
            }else{
                [self.valueFacultatif setText:@"Indifférent"];
                
            }
        }
            break;
            
        case TYPE_REPRISE:{
            
            if(valueSelected == -1){
                [self.valueTypeReprise setText:@"Indifférent"];
                demand_type_reprise = nil;
            }else{
                [self.valueTypeReprise setText:[types objectAtIndex:valueSelected]];
            }
            
            demand_categorie_reprise = nil;
            [self.valueCategorieReprise setText:@"facultatif"];
            
        }
            break;
            
        case CATEGORIE_REPRISE:{
            if(valueSelected == -1){
                [self.valueCategorieReprise setText:@"Indifférent"];
                demand_categorie_reprise = nil;
            }else{
                demand_categorie_reprise = [categories objectAtIndex:valueSelected];
                [self.valueCategorieReprise setText:demand_categorie_reprise];
            }
            
        }
            break;
            
        case CHANTIER_MODELE_REPRISE:{
            
        }
            break;
    }
}

-(void) effacerValues:(NSArray *) values
            withValue:(NSString *) value
{
    
    for (id valeur in values)
    {
        
        if([valeur isKindOfClass:[UITextField class]]){
            UITextField * tmp = (UITextField *) valeur;
            [tmp setPlaceholder:value];
            [tmp setText:@""];
        }else{
            
            if([valeur isKindOfClass:[UILabel class]]){
                UILabel * tmp = (UILabel *) valeur;
                [tmp setText:value];
                
            }
        }
    }
    
    modele_id = nil;
    modele_reprise_id = nil;
    marque_id = nil;
    marque_reprise_id = nil;
    
    demand_type = nil;
    demand_categorie = nil;
    demand_categorie_id = nil;
    demand_type_reprise = nil;
    demand_categorie_reprise = nil;
    demand_etat_id = nil;
    region_id = nil;
    taille_min_range = nil;
    taille_max_range = nil;
}


- (void) receiveDonneesRBGMarqueModele:(NSString *)idMarque
                          andNomMarque:(NSString *)libelleMarque
                           andIdModele:(NSString *)idModele
                          andNomModele:(NSString *)libelleModele{
    if(chantierModelReprise){
        [self.valueChantierModeleReprise setText:[NSString stringWithFormat:@"%@ / %@",libelleMarque,libelleModele]];
        marque_reprise_id = idMarque;
        modele_reprise_id = idModele;
    }
    else{
        [self.valueChantierModele setText:[NSString stringWithFormat:@"%@ / %@",libelleMarque,libelleModele]];
        marque_id = idMarque;
        modele_id = idModele;
    }
}

- (void) receiveDonneesChargement:(id)donnees
                         andType :(int)typeDonnees{
    
    if(typeDonnees == etats){
        appDelegate.donnees.etats = (NSArray *) donnees;
        [self demanderEtat];
        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
        
    }
    
    if(typeDonnees == lieux){
        appDelegate.donnees.lieux = (NSArray *) donnees;
        [self demanderLieu];
        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    }
}

- (void) receiveDonneesRBGRange:(NSString *)minValue
                   andNomModele:(NSString *)maxValue{
    
    
    
    taille_min_range = minValue;
    taille_max_range = maxValue;
    
    if([maxValue isEqualToString:@"+"])
        [self.valueTaille setText:[NSString stringWithFormat:@"de %@ à 16+",minValue]];
    else
        [self.valueTaille setText:[NSString stringWithFormat:@"de %@ à %@",minValue,maxValue]];
    
    
}

-(NSMutableDictionary*)construireDonnees
{
    NSMutableDictionary *d = [NSMutableDictionary dictionary];
    
    if(demand_type == nil){
        [self afficherAlerte:@"Veuillez choisir un type"];
        return nil;
    }
    
    
    if(demand_categorie_id == nil){
        [self afficherAlerte:@"Veuillez choisir une catégorie"];
        return nil;
    }
    
    if(modele_id == nil || marque_id == nil){
        [self afficherAlerte:@"Veuillez entrer une marque et un modèle"];
        return nil;
    }
    
    if(demand_etat_id == nil){
        [self afficherAlerte:@"Veuillez choisir un état"];
        return nil;
    }
    
    if(taille_min_range == nil){
        [self afficherAlerte:@"Veuillez choisir une taille"];
        return nil;
    }
    
    
    if(self.editBudget.text == nil || self.editBudget.text.length == 0){
        [self afficherAlerte:@"Veuillez choisir un budget"];
        return nil;
    }
    

    

    //les requis
    [d setObject:ON_DEMAND_ORIGINE_VALUE forKey:ON_DEMAND_ORIGINE];
    [d setObject:demand_type forKey:ON_DEMAND_TYPE];
    [d setObject:demand_categorie_id forKey:ON_DEMAND_CATEGORIE];
    [d setObject:self.editBudget.text forKey:ON_DEMAND_BUDGET];
    
    
    
    if(self.valueChantierModele.text.length > 0 && modele_id != nil && marque_id != nil)
        [d setObject:modele_id forKey:ON_DEMAND_MODELE];
    
    
    if(demand_etat_id != nil)
        [d setObject:demand_etat_id forKey:ON_DEMAND_ETAT];
    
    if(self.valueTaille.text.length > 0
       && taille_min_range != nil && taille_max_range != nil){
        [d setObject:taille_min_range forKey:ON_DEMAND_TAILLE_MIN];
        [d setObject:taille_max_range forKey:ON_DEMAND_TAILLE_MAX];
    }
    
    if(region_id != nil)
        [d setObject:region_id forKey:ON_DEMAND_LIEU_ID];
    
    //if(((EditText)_commentaire.findViewById(R.id.text)).getText().toString().trim().length() > 0)
    //    Net.add(donnees,Constantes.ON_DEMAND_COMMENTAIRE,((TextView)_commentaire.findViewById(R.id.text)).getText());
    
    if(demand_type_reprise != nil)
        [d setObject:demand_type_reprise forKey:ON_DEMAND_TYPE_POSSEDE];
    
    if(demand_categorie_reprise != nil)
        [d setObject:demand_categorie_reprise forKey:ON_DEMAND_CATEGORIE_POSSEDE];
    
    if(self.valueChantierModeleReprise.text.length > 0
       && modele_reprise_id != nil && marque_reprise_id != nil){
        [d setObject:modele_reprise_id forKey:ON_DEMAND_MODELE_POSSEDE];
        [d setObject:marque_reprise_id forKey:ON_DEMAND_MARQUE_POSSEDE];
    }
    
    if(self.editPrixDeSessionReprise.text.length > 0){
        NSString *s = [self.editPrixDeSessionReprise.text stringByReplacingOccurrencesOfString:@" €" withString:@""];
        [d setObject:s forKey:ON_DEMAND_PRIX_CESSION];
    }
    
    // Ajout du paramètre uniqueRecherche
    [d setObject:ON_DEMAND_UNIQUE_RECHERCHE_VALUE forKey:ON_DEMAND_MODELE_POSSEDE];
    
    [d setObject:@"smartphone" forKey:@"track"];

    return d;
}

- (void) effacerDonnees{
    
    [self effacer];
}
@end

